/******************************************************************************
*  Copyright(c) 2021-2023 Sietium
*
*  @file:    log.h
*  @brif:    categories display debugging information
*
*  @date:    05/10/2021
*  @Author:  cary.Zhang
*
******************************************************************************/
#ifndef LOG_H
#define LOG_H
#include <string>
#include <iostream>

class Log
{
public:
    /**
     * @brif: Emit an informational message
     */
    static void info(const char *fmt, ...);

    static void infoex(const char *infoprefix, const char *color, const char *fmt, ...);

    /**
     * @brif: Emit a debugging message
     */
    static void debug(const char *fmt, ...);

    /**
     * @brif: Emit an error message
     */
    static void error(const char *fmt, ...);

    static void infoerror(const char *fmt, ...);

    /**
     * @brif: A prefix constant that informs the logging infrastructure that the log
     * message is a continuation of a previous log message to be put on the same line.
     */
    static const std::string continuation_prefix;

    static void startwrite();
    static void writeend();
};

#define CASE(msg,...)\
    Log::infoex("CASE","\033[1m\033[32m",msg,__VA_ARGS__);

#define CASESUCESS(msg,...)\
    Log::infoex("SUCESS","\033[32m",msg,__VA_ARGS__);

#define CASEFAILED(msg,...)\
    Log::infoex("FAILED","\033[31m",msg,__VA_ARGS__);

#define LOG(msg,...)\
    Log::infoex("   |","\033[36m",msg,__VA_ARGS__);

#define LOGINFO(msg)\
    Log::infoex("   |","\033[36m",msg);
#define clearlastline(msg)\
    Log::infoex("","\033[k",msg);
#endif /* LOG_H_ */
